<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});


$api = app('Dingo\Api\Routing\Router');
$func = function ($api) {
    $api->group(['namespace' => 'App\Api\V2\Controller\Bill\User', 'prefix' => 'v2/Bill/User', 'middleware' => 'user.api'], function ($api) {

        $api->get("merchantExchangeCount", "CountController@merchantExchangeCount");

        $api->get("merchantExchangeCountList", "CountController@merchantExchangeCountList");
        $api->get("merchantExchangeCountListExport", "CountController@merchantExchangeCountListExport");


        $api->get("merchantExchangeCountV2", "CountController@merchantExchangeCountV2");


        $api->get("storeExchangeCount", "CountController@storeExchangeCount");

        $api->get("storeCompanyExchangeCount", "CountController@storeCompanyExchangeCount");

        $api->group(['prefix' => 'WxCount'], function ($api) {
            //小程序统计 每日收款统计
            $api->get("staticDailyCount", "WxCountController@staticDailyCount");
            //小程序统计 每日收款分组统计
            $api->get("staticDailyCountList", "WxCountController@staticDailyCountList");
            $api->get("staticStoreGroupCount", "WxCountController@staticStoreGroupCount");
            $api->get("staticStoreGroupCountList", "WxCountController@staticStoreGroupCountList");
            $api->get("payTypeCount", "WxCountController@payTypeCount");

            $api->get("staticBillLogList", "WxCountController@staticBillLogList");

        });

        //财务对账
        $api->group(["prefix" => "Finance"], function ($api) {
            $api->get("financeMonthCount", "FinanceController@financeMonthCount");
            $api->post("financeMonthCountExport", "FinanceController@financeMonthCountExport");

            $api->get("staticBillLogList", "FinanceController@staticBillLogList");
            $api->post("staticBillLogListExport", "FinanceController@staticBillLogListExport");

            $api->post("markUser", "FinanceController@markUser");

        });

        //趋势图
        $api->group(["prefix" => "TrendChart"], function ($api) {
            //主店环比同比确实
            $api->get("pstoreTrend", "TrendChartController@pstoreTrend");
            $api->post("pstoreTrendExport", "TrendChartController@pstoreTrendExport");

            //代理商同比环比趋势
            $api->get("agentTrend", "TrendChartController@agentTrend");
            $api->post("agentTrendExport", "TrendChartController@agentTrendExport");

        });

        $api->group(["prefix" => "Count"], function ($api) {
            $api->get("storeCompanyGroupCountList", "CountController@storeCompanyGroupCountList");
            $api->post("storeCompanyGroupCountListExport", "CountController@storeCompanyGroupCountListExport");
        });

    });


    $api->group(['namespace' => 'App\Api\V2\Controller\Bill\Merchant', 'prefix' => 'v2/Bill/Merchant', 'middleware' => 'merchant.api'], function ($api) {

        //web
        $api->get("merchantBiCount", "CountController@merchantBiCount");

        //小程序
        $api->group(['prefix' => 'WxCount'], function ($api) {

            $api->get("staticCount", "WxCountController@staticCount");

            $api->get("staticGroupCountList", "WxCountController@staticGroupCountList");

            $api->get("staticBillLogList", "WxCountController@staticBillLogList");

        });
    });


    //分润-代理商查看
    $api->group(["namespace" => "App\Api\V2\Controller\Commission\User", "prefix" => "v2/Commission/User", "middleware" => "user.api"], function ($api) {

        $api->get("userCommission", "CommissionController@userCommission");

        $api->get("userCommissionLog", "CommissionController@userCommissionLog");

        $api->get("userSubCommission", "CommissionController@userSubCommission");

        $api->get("userSubCommissionLog", "CommissionController@userSubCommissionLog");


    });


};

$api->version("v1", $func);









/*   Route::group(["prefix" => "v2"], function () {

       Route::group(["prefix" => "incoming"], function () {
           Route::group(["prefix" => "Qr", "middleware" => \App\Http\Middleware\AuthenticateApi::class], function () {
               Route::post("createQr", "\App\Api\V2\Controller\Incoming\QrController@createQr");

               Route::get("lists", "\App\Api\V2\Controller\Incoming\QrController@lists");
           });

       });
   });*/

